/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MyDataContainer;

import java.util.ArrayList;

/**
 *
 * @author Welcome
 */
public class MyTable extends MyQuery{
    //<editor-fold defaultstate="collapsed" desc="1/ Các thuộc tính cơ bản">
    private MyDataString primaryKeys;
    private ArrayList<MyForeignKey> foreignKeys;
    //</editor-fold>
    
    //<editor-fold defaultstate="collapsed" desc="2/Các phương thức khởi tạo">
    public MyTable() {
        super();
        primaryKeys = new MyDataString();
        foreignKeys = new ArrayList<MyForeignKey>();
    }
    
    public MyTable(MyQuery myQuery, MyDataString primaryKeys, ArrayList<MyForeignKey> foreignKeys) {
        super(myQuery);
        primaryKeys = new MyDataString();
        foreignKeys = new ArrayList<MyForeignKey>();
    }
    
    public MyTable(MyDataString primaryKeys, ArrayList<MyForeignKey> foreignKeys, MyDataString columnTitles, MyDataString dataTypeList, ArrayList<MyDataSet> rowContents, String name) {
        super(columnTitles, dataTypeList, rowContents, name);
        primaryKeys = new MyDataString();
        foreignKeys = new ArrayList<MyForeignKey>();
    }
    
    public MyTable(MyTable myTable)
    {
        this.columnTitles = new MyDataString(myTable.columnTitles);
        this.dataTypeList = new MyDataString(myTable.dataTypeList);
        this.rowContents = new ArrayList<MyDataSet>(myTable.rowContents);
        this.name=myTable.name;
        primaryKeys = new MyDataString();
        foreignKeys = new ArrayList<MyForeignKey>();
    }
    public MyTable(MyQuery myQuery)
    {
        this.name = myQuery.name;
        this.columnTitles=new MyDataString(myQuery.columnTitles);
        this.dataTypeList=new MyDataString(myQuery.dataTypeList);
        this.rowContents = new ArrayList<MyDataSet>(myQuery.getRowContents());
        
        this.foreignKeys=new ArrayList<MyForeignKey>();
        this.primaryKeys=new MyDataString();
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="3/Các phương thức Get/Set">
    public ArrayList<MyForeignKey> getForeignKeys() {
        return foreignKeys;
    }
    
    public void setForeignKeys(ArrayList<MyForeignKey> foreignKeys) {
        this.foreignKeys = foreignKeys;
    }
    
    public MyDataString getPrimaryKeys() {
        return primaryKeys;
    }
    
    public void setPrimaryKeys(MyDataString primaryKeys) {
        this.primaryKeys = primaryKeys;
    }
    
    @Override
    public void showData()
    {
        System.out.println(this.name);
        columnTitles.showData();
        dataTypeList.showData();
        primaryKeys.showData();
        for(int i=0; i<foreignKeys.size();i++)
        {
            foreignKeys.get(i).showForeignKey();
        }
        for(int i=0; i<rowContents.size();i++)
        {
            rowContents.get(i).showData();
            System.out.println();
        }
    }
    //</editor-fold>
   
    
    
}
